home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_300 / 353_02 / vehicle.cpp < prev    next >
C/C++ Source or Header  |  1992-01-18  |  592b  |  33 lines

  1.                                   // Chapter 7 - Program 2
  2. #include "vehicle.h"
  3.  
  4.  
  5.  
  6.               // initialize to any data desired
  7. void vehicle::initialize(int in_wheels, float in_weight)
  8. {
  9.    wheels = in_wheels;
  10.    weight = in_weight;
  11. }
  12.  
  13.  
  14.               // get the number of wheels of this vehicle
  15. int vehicle::get_wheels()
  16. {
  17.    return wheels;
  18. }
  19.  
  20.  
  21.               // return the weight of this vehicle
  22. float vehicle::get_weight()
  23. {
  24.    return weight;
  25. }
  26.  
  27.  
  28.               // return the weight on each wheel
  29. float vehicle::wheel_loading()
  30. {
  31.    return weight/wheels;
  32. }
  33.